//
//  HDBaseViewController.swift
//  个人微博
//
//  Created by 爱生活Geek on 16/10/21.
//  Copyright © 2016年 爱生活. All rights reserved.
//

import UIKit

class HDBaseViewController: UIViewController {

    // MARK: - 添加自定义的导航条
    lazy var navigationBar = UINavigationBar(frame: CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 64))
    
    lazy var navItem = UINavigationItem()
    
    override func viewDidLoad() {
        
        super.viewDidLoad()
        
        setupUI()
    }
    
    /// 重写set方法
    override var title: String?{
        didSet{
            navItem.title = title
        }
    }
}
extension HDBaseViewController{
    
    func setupUI(){
        
        view.backgroundColor = UIColor.white
        
        view.addSubview(navigationBar)
        
        navigationBar.items = [navItem]
        
        navigationBar.barTintColor = UIColor(red: 246 / 256, green: 246 / 256, blue: 246 / 256, alpha: 1)
        
        navigationBar.tintColor = UIColor.darkGray
        
        navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.darkGray]
    }
}
